/*
 * @Author: your name
 * @Date: 2021-03-30 11:53:29
 * @LastEditTime: 2021-03-30 19:29:30
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \shop\training-group-5-warehouse\dianshang\src\store\login.js
 */
//登录
export default {
    namespaced: true,
    state: {
        userInfo: JSON.parse(localStorage.getItem("userInfo")) || {},//用户信息
        userInfos: JSON.parse(localStorage.getItem("userInfos")) || []//砍价用户记录信息
    },
    mutations: {
        SET_USERINFO(state, action) {
            state.userInfo = action;//存储用户信息
            state.userInfos.push(action);//添加砍价用户记录信息
            localStorage.setItem("userInfo", JSON.stringify(state.userInfo));
            localStorage.setItem("userInfos", JSON.stringify(state.userInfos));
        }
    },
    actions: {},
}